#!/bin/bash -x

wmctrl -l | grep GVIM
status=$?
if [ ${status} -eq 1 ] ; then
	exit 0
fi

line=`wmctrl -l | awk '{ print $4 "  -  " $5 "  -  " $7 }' | grep GVIM | zenity --list --width=600 --height=300 --title="gvim windows" --column="gvim windows" --hide-header --text="Select a window"`
status=$?

if [ ${status} -eq 1 ] || [ -z "${line}" ]; then
    exit 0
fi

wmctrl -a `echo ${line} | awk '{ print $NF }'`
